﻿//=====================================================
// Copyright © 2017-2018 xuxuzhaozhao
// All rights reserved
// GUID: 594e70b6-92df-4213-8bdc-c1120ae2f614
// CLR版本: 4.0.30319.42000
// 新建项输入的名称: BloggerEntities
// 机器名称: WIN10-20170502F
// 注册组织名: 成都名门汇科技有限公司（谊诚科技）
// 命名空间名称: UnitTestingWebAPI.Data
// 文件名: BloggerEntities
// 当前系统时间: 2017/10/21 17:20:44
// 当前登录用户名: xuxuzhaozhao
//======================================================

using System.Data.Entity;
using UnitTestingWebAPI.Data.Configurations;
using UnitTestingWebAPI.Domain;

namespace UnitTestingWebAPI.Data
{
    public class BloggerEntities : DbContext
    {
        public BloggerEntities()
            : base("BloggerEntities")
        {
            Configuration.ProxyCreationEnabled = false;
        }

        public DbSet<Blog> Blogs { get; set; }
        public DbSet<Article> Articles { get; set; }

        public virtual void Commit()
        {
            base.SaveChanges();
        }

        protected override void OnModelCreating(DbModelBuilder modelBuilder)
        {
            modelBuilder.Configurations.Add(new ArticleConfiguration());
            modelBuilder.Configurations.Add(new BlogConfiguration());
        }
    }
}
